﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using DB.SchemaSync.Library.Interfaces;
using DB.SchemaSync.Library.Models;

namespace BDSync.Domains.DBSnapShot
{
    public interface IDBCompareServices
    {
        IDbConnectionProvider DbTarProvider { get; }
        String DbTarConnStr { get; set; }
        Task<Database> GetDataBase();
        bool CheckConn();

        /// <summary>
        /// 执行比较
        /// </summary>
        /// <param name="dbJsonFile"></param>
        /// <returns></returns>
        Task<(IEnumerable<DbObject> Create, IEnumerable<AlteredObject> Alter, IEnumerable<DbObject> Drop)> ExceCompare(string dbJsonFile);

        /// <summary>
        /// 执行比较 
        /// </summary>
        /// <param name="dbJsonFile"></param>
        /// <returns></returns>
        IEnumerable<string> ExportSqlForSelection();

        /// <summary>
        /// 执行比较 
        /// </summary>
        /// <param name="dbJsonFile"></param>
        /// <returns></returns>
        IEnumerable<string> ExportSql();


        /// <summary>
        /// 执行比较 
        /// </summary>
        /// <param name="dbJsonFile"></param>
        /// <returns></returns>
        void ExportSqlFileForSelection(string filepath);

        /// <summary>
        /// 执行比较 
        /// </summary>
        /// <param name="dbJsonFile"></param>
        /// <returns></returns>
        void ExportSqlFile(string filepath);

        /// <summary>
        /// 执行差异sql
        /// </summary>
        string ExecSql();

        /// <summary>
        /// 执行所选差异sql
        /// </summary>
        string ExecSqlForSelection();
    }
}